package com.sdutcm.Mapper;

/*
 *@Author Yan
 *@Create 2019-08-24 0:37
 */

import com.sdutcm.Domain.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {

    @Insert("Insert INTO student(s_id,s_name,s_tel,s_college,s_department,s_leisure_1,s_leisure_2,s_leisure_3,s_leisure_4,s_leisure_5,s_leisure_6,s_leisure_7,s_leisure_8,s_leisure_9,s_leisure_10,s_leisure_11,s_leisure_12,s_leisure_13,s_leisure_14,s_leisure_15) VALUES(#{s_id},#{s_name},#{s_tel},#{s_college},#{s_department},#{s_leisure_1},#{s_leisure_2},#{s_leisure_3},#{s_leisure_4},#{s_leisure_5},#{s_leisure_6},#{s_leisure_7},#{s_leisure_8},#{s_leisure_9},#{s_leisure_10},#{s_leisure_11},#{s_leisure_12},#{s_leisure_13},#{s_leisure_14},#{s_leisure_15})")
    public void studentadd(Student student) throws Exception ;

//    查询现在成员
    @Select("select * from student where s_exit = 0")
    public List<Student> studentlist() throws Exception;

//    查看历史成员
    @Select("select * from student")
    public List<Student> studentlist_his() throws Exception;

//    按照id查询
    @Select("select * from student where s_id = #{s_id} and s_exit = 0")
    public Student studentById(Integer s_id) throws Exception;

    //修改个人信息
    @Update("UPDATE student SET s_name = #{s_name}, s_tel = #{s_tel}, s_college = #{s_college}, s_department = #{s_department}, s_leisure_1 = #{s_leisure_1}, s_leisure_2 = #{s_leisure_2}, s_leisure_3 = #{s_leisure_3}, s_leisure_4 = #{s_leisure_5}, s_leisure_6 = #{s_leisure_6}, s_leisure_7 = #{s_leisure_7}, s_leisure_8 = #{s_leisure_8}, s_leisure_9 = #{s_leisure_9}, s_leisure_10 = #{s_leisure_10}, s_leisure_11 = #{s_leisure_11}, s_leisure_12 = #{s_leisure_12}, s_leisure_13 = #{s_leisure_13}, s_leisure_14 = #{s_leisure_14}, s_leisure_15 = #{s_leisure_15} ,s_exit = #{s_exit} where s_id = #{s_id}")
    public void studentedit(Student student) throws Exception;
}
